clear all;
%% plot 
fig=figure('color', [1 1 1 ], 'Position',[200 20 800 400]);

A=load('panelA.mat');
B=load('panelB.mat');

ah1 = axes('Parent',fig,'Units','normalized','Position',[0.1300 0.3200 0.3347 0.624]);

plot(A.x1, A.y1, '-b' , 'LineWidth', 2 );
hold on
plot(A.x3, A.y3, '-.r' , 'LineWidth', 2 );
hold on
plot(A.x2, A.y2, '--b' , 'LineWidth', 2 );
hold on
plot(A.x4, A.y4, ':r' , 'LineWidth', 2 );

title( 'A. Given $a_t/(m_t+a_t)$', 'FontSize',15,'Interpreter','Latex');
xlabel('total wealth $m_t+a_t$', 'FontSize',12,'Interpreter','Latex');
ylabel('talent $z_t$', 'FontSize',12,'Interpreter','Latex');
text(2.4, 1.7, 'withdrawal', 'FontSize',10,'Interpreter','Latex');
text(0.7, 1.2, 'inaction', 'FontSize',10,'Interpreter','Latex');
text(3.95, 1.1, 'deposit', 'FontSize',10,'Interpreter','Latex');
xlim([0,5]);
ylim([1,2]);
% yticks(1.0:0.3:2.5);
set(gca,'FontSize',12);

ah2 = axes('Parent',fig,'Units','normalized','Position',[0.5703 0.3200 0.3347 0.624]);

plot(B.x1, B.y1, '-b' , 'LineWidth', 2 );
hold on
plot(B.x3, B.y3, '-.r' , 'LineWidth', 2 );
hold on
plot(B.x2, B.y2, '--b' , 'LineWidth', 2 );
hold on
plot(B.x4, B.y4, ':r' , 'LineWidth', 2 );

text(2, 0.97, 'withdrawal', 'FontSize',10,'Interpreter','Latex');
text(1.2, 0.45, 'inaction', 'FontSize',10,'Interpreter','Latex');
text(3.9, 0.11, 'deposit', 'FontSize',10,'Interpreter','Latex');

xlim([0,5]);
ylim([0,1]);

title( 'B. Given $z_t$', 'FontSize',15,'Interpreter','Latex');
xlabel('total wealth $m_t+a_t$', 'FontSize',12,'Interpreter','Latex');
ylabel('deposit-wealth ratio $a_t/(m_t+a_t)$', 'FontSize',12,'Interpreter','Latex');
set(gca,'FontSize',12);
legend('withdrawal boundary ($d_{i,t}=2$ min)','withdrawal boundary ($d_{i,t}=0$ min)',...
    'deposit boundary ($d_{i,t}=2$ min)','deposit boundary ($d_{i,t}=0$ min)',...
    'interpreter','latex','location',[0.52 0.12 0 0],'Numcolumns',2)
% get(handle,'position');
